package ru.osu.acm.common.entities;

import ru.osu.acm.testing.Utils;

/**
 * User: Aleksey
 * Date: 17.02.2009
 * Time: 19:58:22
 */
public class Problem {
    private int id;
    private String name;
    private String inputFile;
    private String outputFile;
    private int timeLimit;
    private Checker checker;
    private String statement;
    private String inputDescription;
    private String outputDescription;
    private String inputExample;
    private String outputExample;

    private int index; // TODO: here????

    public Problem(int id, String name, String inputFile, String outputFile, int timeLimit, Checker checker, String statement, String inputDescription, String outputDescription, String inputExample, String outputExample, int index) {
        this.id = id;
        this.name = name;
        this.inputFile = inputFile;
        this.outputFile = outputFile;
        this.timeLimit = timeLimit;
        this.checker = checker;
        this.statement = statement;
        this.inputDescription = inputDescription;
        this.outputDescription = outputDescription;
        this.inputExample = inputExample;
        this.outputExample = outputExample;
        this.index = index;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getInputFile() {
        return inputFile;
    }

    public void setInputFile(String inputFile) {
        this.inputFile = inputFile;
    }

    public String getOutputFile() {
        return outputFile;
    }

    public void setOutputFile(String outputFile) {
        this.outputFile = outputFile;
    }

    public int getTimeLimit() {
        return timeLimit;
    }

    public int getTimeLimit(int testNumber) {
        return testNumber > 0 ? timeLimit : timeLimit * 4;
    }

    public void setTimeLimit(int timeLimit) {
        this.timeLimit = timeLimit;
    }

    public Checker getChecker() {
        return checker;
    }

    public void setChecker(Checker checker) {
        this.checker = checker;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public String getLetter() {
        if (index >= 0) {
            return (char)('A' + index) + "";
        }
        return "";
    }

    public String getLetterWithPoint() {
        if (index >= 0) {
            return (char)('A' + index) + ". ";
        }
        return "";
    }

    public String getStatement() {
        return statement;
    }

    public String getStatementHtml() {
        return Utils.prepareStringForHtml(statement);
    }

    public void setStatement(String statement) {
        this.statement = statement;
    }

    public String getInputDescription() {
        return inputDescription;
    }

    public String getInputDescriptionHtml() {
        return Utils.prepareStringForHtml(inputDescription);
    }

    public void setInputDescription(String inputDescription) {
        this.inputDescription = inputDescription;
    }

    public String getOutputDescription() {
        return outputDescription;
    }

    public String getOutputDescriptionHtml() {
        return Utils.prepareStringForHtml(outputDescription);
    }

    public void setOutputDescription(String outputDescription) {
        this.outputDescription = outputDescription;
    }

    public String getInputExample() {
        return inputExample;
    }

    public void setInputExample(String inputExample) {
        this.inputExample = inputExample;
    }

    public String getOutputExample() {
        return outputExample;
    }

    public void setOutputExample(String outputExample) {
        this.outputExample = outputExample;
    }
}
